Creates the password from the given bytes and salt
Syntax
Example
Library/Library.Test/TestPassword.cs
C# | Copy Code |
---|
const int count = 1000;
Random rand = new Random();
byte[] bytes = new byte[100];
rand.NextBytes(bytes);
Stopwatch time = new Stopwatch();
time.Start();
for (int i = 0; i < count; i++)
{
bytes = new byte[rand.Next(450) + 50];
rand.NextBytes(bytes);
using (Password pwd = new Password(false, bytes))
{
byte[] copy = IOStream.ReadAllBytes(pwd.ReadBytes());
Assert.AreEqual(bytes, copy);
}
}
time.Stop();
Trace.WriteLine(time.Elapsed.ToString(), count.ToString() + " Passwords"); |
VB.NET | Copy Code |
---|
Const count As Integer = 1000
Dim rand As New Random()
Dim bytes As Byte() = New Byte(100) {}
rand.NextBytes(bytes)
Dim time As New Stopwatch()
time.Start()
Dim i As Integer = 0
While i < count
bytes = New Byte(rand.[Next](450) + 50) {}
rand.NextBytes(bytes)
Using pwd As New Password(False, bytes)
Dim copy As Byte() = IOStream.ReadAllBytes(pwd.ReadBytes())
Assert.AreEqual(bytes, copy)
End Using
System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1)
End While
time.[Stop]()
Trace.WriteLine(time.Elapsed.ToString(), count.ToString() + " Passwords") |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also